package com.luo.chengrui.module.crbpm.dal.mysql.definition;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import com.luo.chengrui.module.crbpm.controller.admin.definition.vo.modelactivity.ModelActivityPageReqVO;
import com.luo.chengrui.module.crbpm.dal.dataobject.definition.ModelActivityDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 流程模型正式版环节 Mapper
 *
 * @author luodz
 */
@Mapper
public interface ModelActivityMapper extends BaseMapperX<ModelActivityDO> {

    default PageResult<ModelActivityDO> selectPage(ModelActivityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ModelActivityDO>()
                .eqIfPresent(ModelActivityDO::getModelId, reqVO.getModelId())
                .eqIfPresent(ModelActivityDO::getModelKey, reqVO.getModelKey())
                .eqIfPresent(ModelActivityDO::getActivityId, reqVO.getActivityId())
                .likeIfPresent(ModelActivityDO::getActivityName, reqVO.getActivityName())
                .eqIfPresent(ModelActivityDO::getActivityType, reqVO.getActivityType())
                .eqIfPresent(ModelActivityDO::getConditionType, reqVO.getConditionType())
                .eqIfPresent(ModelActivityDO::getConditionFormat, reqVO.getConditionFormat())
                .eqIfPresent(ModelActivityDO::getConditionPattern, reqVO.getConditionPattern())
                .eqIfPresent(ModelActivityDO::getFullActivityId, reqVO.getFullActivityId())
                .likeIfPresent(ModelActivityDO::getFullActivityName, reqVO.getFullActivityName())
                .eqIfPresent(ModelActivityDO::getExt1, reqVO.getExt1())
                .eqIfPresent(ModelActivityDO::getExt2, reqVO.getExt2())
                .eqIfPresent(ModelActivityDO::getExt3, reqVO.getExt3())
                .eqIfPresent(ModelActivityDO::getExt4, reqVO.getExt4())
                .eqIfPresent(ModelActivityDO::getExt5, reqVO.getExt5())
                .eqIfPresent(ModelActivityDO::getExt6, reqVO.getExt6())
                .eqIfPresent(ModelActivityDO::getExt7, reqVO.getExt7())
                .eqIfPresent(ModelActivityDO::getExt8, reqVO.getExt8())
                .eqIfPresent(ModelActivityDO::getExt9, reqVO.getExt9())
                .eqIfPresent(ModelActivityDO::getExt10, reqVO.getExt10())
                .eqIfPresent(ModelActivityDO::getSort, reqVO.getSort())
                .eqIfPresent(ModelActivityDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ModelActivityDO::getVersion, reqVO.getVersion())
                .orderByDesc(ModelActivityDO::getId));
    }


    void physicalDeletion(String modelId);
}
